<link  type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" rel="stylesheet"/>
<script type="text/javascript" src="https://www.layuicdn.com/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
      dir: 'https://www.layuicdn.com/layui/' 
      ,version: false 
      ,debug: false 
      ,base: '' 
    });
</script>  



<!-- 框架的倒计时组件文档 "https://www.layui.com/doc/modules/util.html#countdown" -->
<div id="test" style="background-color: #999;color:#fff;font-size: 14px;line-height: 40px;height: 40px;text-align: center;"></div>

<script type="text/javascript">
	layui.use('util', function(){
		var util = layui.util;
		  //示例
		  var endTime = new Date(2020,9-1,30).getTime() //假设为结束日期
		  ,serverTime = new Date().getTime(); //假设为当前服务器时间，这里采用的是本地时间，实际使用一般是取服务端的
		  util.countdown(endTime, serverTime, function(date, serverTime, timer){
		  	var str = date[0] + '天' + date[1] + '时' +  date[2] + '分' + date[3] + '秒';
		  	layui.$('#test').html('购物补贴<span style="font-size:18px;font-weight:600">65.9</span>元  '
		  		+ str+'后失效');
		});
	});    
</script>
